package Logic;

import Core.Log4j2;

public class PropStub {
    public int templateId;
    public int id;
    public String name;
    public int type;
    public int value;
    public boolean valid;
    public float life;
    private float timeAccumulationSinceGen;
    private float x, y, angle;

    public PropStub(int templateId, int id, String name, int type, int value, float life) {
        this.templateId = templateId;
        this.id = id;
        this.name = name;
        this.type = type;
        this.value = value;
        this.valid = true;
        this.life = life;

        timeAccumulationSinceGen = 0;
    }

    //参数的单位是秒
    public void Update(float deltaTime) {
        timeAccumulationSinceGen += deltaTime;
//        Log4j2.LOGGER.warn("道具时间(seconds)：" + timeAccumulationSinceGen + ". Life = " + life);

        if (timeAccumulationSinceGen > life) {
            valid = false;
        }
    }

    public void SetTransform(float x, float y, float angle) {
        this.x = x;
        this.y = y;
        this.angle = angle;
    }

    public float GetX() {
        return x;
    }

    public float GetY() {
        return y;
    }

    public float GetAngle() {
        return angle;
    }
}
